<div id="main_content">
<h1>Organization Maintenance</h1>
<div id="blanket" style="display:none;"></div>
<table class="blue" width="100%">
	<tr valign="top" width="100%">
		<td width="99%" align="left">
			<div id="search" >
				<form name="searchForm" id="searchForm" method="POST">
					<h3><b>Searching<b></h3>
					<table width="100%" >
						<tr>
							<td width="15%"><label>Country:</label></td>
							<td>
								<div id="country">
								<select id="country" name="country" onchange="doajaxAction('/admin/dataFMAProvince/country/'+document.searchForm.country.value,0,'province');">
									<option value=""> --- </option>
									{foreach from=$countries item=country}
									<option value="{$country.country_code}">{$country.country}</option>
									{/foreach}
								</select>
								</div>
							</td>
						</tr>
						<tr>
							<td><label>Province:</label></td>
							<td>
								<div id="province">
								<select name="province">
									<option value=""> --- </option>
								</select>
								</div>
							</td>
						</tr>
						<tr>
							<td><label>Name:</label></td>
							<td>
								<input type="text" name="names">
							</td>
							<td align="right">
								<input type="button" value="Go" onclick="search_organism();">
							</td>
						</tr>
					</table>
				</form>
			</div>
			<br><br>
		</td>
		<td>
			<a onclick="toggle_div('search');" href="javascript:void(0);">
				<img id="show_arrow" border="0" src="/app/default/www/images/arrow-down.png" alt="Show Search"/>
			</a>
		</td>
	</tr>
	<tr  valign="top" width="100%">
		<td width="99%" align="left">
			<div id="batch" style="display:none;" >
				<form name="mainForm" method="POST" id="mainForm" action="/admin/dataFMAImport" enctype="multipart/form-data">
					<h3><b>Batch Upload:</b></h3>
					<table width="100%">
						<tr>
							<td width="15%"><label>Click here to export spreadsheet:</label></td>
							<td><input type="button" onclick="export_excel();" value="Export"></td>
						</tr>
						<tr>
							<td>
								<input type="file" name="file" id="file" />
							</td>
							<td>
								<input type="submit" value="Upload">
							</td>
						</tr>
					</table>
					<br>
				</form>
			</div>
		</td>
		<td>
			<a onclick="toggle_div('batch');" href="javascript:void(0);">
				<img id="show_arrow" border="0" src="/app/default/www/images/arrow-down.png" alt="Show Search"/>
			</a>
		</td>
	</tr>
</table>
<br><br>
<form name="mainForm" method="POST" id="mainForm" action="/admin/dataFMASaveListChanges" enctype="multipart/form-data">
<input type="hidden" id="rowcount" value="{$rowcount}">
<div id="data_table" width="100%">
	<!--table width="100%">
		<tr bgcolor="#cccccc">
			<td width="5%"></td>
			<td width="5%" align="center"><label><b>Delete</b></label></td>
			<td><label><b>Name</b></label></td>
			<td><label><b>Country</b></label></td>
			<td><label><b>Province</b></label></td>
			<td><label><b>Organization Type</b></label></td>
		</tr>
		{foreach from=$results item=result}
			<tr class="{cycle values=blue,notify}">
				<td width="5%" align="center"><input type="button" value="Edit" onclick="edit_item({$result.id});"></td>
				<td width="5%" align="center"><input type="checkbox" value="1" name="del_{$result.id}"></td>
				<td><label>{$result.name}</label></td>
				<td><label>{$result.country}</label></td>
				<td><label>{$result.province}</label></td>
				<td><label>{$result.org_type}</label></td>
			</tr>
		{/foreach}
	</table-->
<input type="button" value="Add" onclick="edit_item(0);">
<input type="submit" value="Save Changes">
</div>
</form>

{literal}
<script language="javascript">
	function edit_item(id){
		doajaxAction('/admin/dataFMAEdit/id/'+id,0,'main_content');
	}
	function search_organism(){
		var params='/country/'+document.searchForm.country.value+
				   '/province/'+document.searchForm.province.value+
				   '/names/'+document.searchForm.names.value;
		doajaxAction('/admin/dataOFMASearch'+params,0,'data_table');
	}
	function export_excel(){
		window.location="/admin/dataFMAExport";
	}
</script>
{/literal}
</div>
	
	
	